package com.ds.infrastructure.hyperspace.common;

import java.net.SocketAddress;

/**
 *
 * @author  Weishaoying
 */
public interface EndpointNode<T> {

    /**
     * id
     * @return
     */
    String getKey();

    /**
     * increment node fail count
     * @param remoteAddress
     */
    void incrementFailCount(SocketAddress remoteAddress);

    /**
     * increment node pass count
     * @param remoteAddress
     */
    void incrementPassCount(SocketAddress remoteAddress);

    /**
     * True if node active
     * @return
     */
    boolean isAvailable();

    /**
     * Get node config
     * @return
     */
    T getNodeConfig();

    /**
     * Get host header
     * @return
     */
    String getHostHeader();

    /**
     * Get host info
     * @return
     */
    String getHostInfo();

    /**
     * Update node config
     * @param nodeConfig
     */
    void updateNodeConfig(T nodeConfig);

    /**
     * Get correlation endpoint
     * @return
     */
    Endpoint getEndpoint();

    /**
     * Release resource and close
     */
    void shutdown();

    /**
     * Is empty nodes
     * @return
     */
    boolean isEmptyNodes();
}
